home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
Sources C- WorkDisk V.adf
/
scroll.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-02-15
|
3KB
|
130 lines
#include "exec/types.h"
#include "intuition/intuition.h"
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Screen *Scrn;
struct Window *NoBorder;
struct RastPort *rp;
struct ViewPort *vp;
#define WIDTH 320*3
#define HEIGHT 200
#define MODBLU 0x10
#define MODRED 0x20
#define MODGRN 0x30
struct NewScreen NewScrn =
{
0,0,
WIDTH,HEIGHT,6,
1,0,
HAM,
CUSTOMSCREEN,
NULL, /* Pointer to custom font */
NULL, /* Pointer to title text */
NULL, /* Pointer to screen gadgets */
NULL /* Pointer to custom bitmap */
};
struct NewWindow NewNoBorder =
{
0,0,
WIDTH,HEIGHT,
0,0,
CLOSEWINDOW, /* IDCMP flags */
SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE, /* flags */
NULL, /* Pointer to first gadget */
NULL, /* Pointer to Check Mark image */
NULL, /* Title */
NULL, /* Pointer to Screen structure */
NULL, /* Pointer to custom bitmap */
0,0, /* Min Width, Min Height */
0,0, /* Max Width, Max Height */
CUSTOMSCREEN /* Type of Screen this window resides on */
};
main()
{
OpenALL();
if((NewNoBorder.Screen = Scrn = (struct Screen *)OpenScreen(&NewScrn)) == NULL)
CloseALL();
if((NoBorder = (struct Window *)OpenWindow(&NewNoBorder)) == NULL)
CloseALL();
vp = (struct ViewPort *) ViewPortAddress(NoBorder);
rp = NoBorder->RPort;
SetRGB4(vp,0,0,0,0);
SetRGB4(vp,1,15,0,0);
SetRGB4(vp,2,0,0,15);
SetRGB4(vp,3,0,15,0);
drawham();
scroll();
Wait(1 << NoBorder->UserPort->mp_SigBit);
CloseALL();
}
OpenALL()
{
if((IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library",0)) == NULL) CloseALL();
if((GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library",0)) == NULL) CloseALL();
}
CloseALL()
{
if(NoBorder) CloseWindow(NoBorder);
if(Scrn) CloseScreen(Scrn);
if(GfxBase) CloseLibrary(GfxBase);
if(IntuitionBase) CloseLibrary(IntuitionBase);
exit(1);
}
drawham()
{
int c;
for(c=0;c<320-10;c+=10)
{
RectFill(rp,c,0,c+9,199);
SetAPen(rp,MODRED+ ((c+10)/10%16) );
RectFill(rp,320+c,0,c+329,199);
SetAPen(rp,MODGRN+ ((c+10)/10%16) );
RectFill(rp,640+c,0,c+649,199);
}
} /* end of Ham() */
scroll()
{
int i;
for(i=1;i<=WIDTH-320;i++)
{
Scrn->ViewPort.RasInfo->RxOffset=i;
MakeScreen(Scrn);
RethinkDisplay();
}
for(i=WIDTH-320;i;i--)
{
Scrn->ViewPort.RasInfo->RxOffset=i-1;
MakeScreen(Scrn);
RethinkDisplay();
}
}